<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>IDA SDK: offset.hpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">IDA SDK
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Header&#160;Files</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">offset.hpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Functions that deal with offsets. </p>
<p>"Being an offset" is a characteristic of an operand. This means that operand or its part represent offset from some address in the program. This linear address is called "offset base". Some operands may have 2 offsets simultaneously. Generally, IDA doesn't handle this except for Motorola outer offsets. Thus there may be two offset values in an operand: simple offset and outer offset.</p>
<p>Outer offsets are handled by specifying special operand number: it should be ORed with <a class="el" href="group___f_f__op.html#gae3ff56ce8ed4030acdca9d9314038dfb" title="outer offset base (combined with operand number). ">OPND_OUTER</a> value.</p>
<p>See <a class="el" href="bytes_8hpp.html" title="Contains functions that deal with individual byte characteristics. ">bytes.hpp</a> for further explanation of operand numbers. </p>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:abab62af2f5bde2632931d05e4dea7c68"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="nalt_8hpp.html#aa749dc39c69b710b5fcd35616b8267a9">reftype_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#abab62af2f5bde2632931d05e4dea7c68">get_default_reftype</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea)</td></tr>
<tr class="memdesc:abab62af2f5bde2632931d05e4dea7c68"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get default reference type depending on the segment.  <a href="#abab62af2f5bde2632931d05e4dea7c68">More...</a><br /></td></tr>
<tr class="separator:abab62af2f5bde2632931d05e4dea7c68"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5401e9949fa39da243b0ff771fac6e02"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a5401e9949fa39da243b0ff771fac6e02">op_offset_ex</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, const <a class="el" href="structrefinfo__t.html">refinfo_t</a> *ri)</td></tr>
<tr class="memdesc:a5401e9949fa39da243b0ff771fac6e02"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert operand to a reference.  <a href="#a5401e9949fa39da243b0ff771fac6e02">More...</a><br /></td></tr>
<tr class="separator:a5401e9949fa39da243b0ff771fac6e02"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af234e8b816269e8aedda0caeac054574"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af234e8b816269e8aedda0caeac054574"></a>
<a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#af234e8b816269e8aedda0caeac054574">op_offset</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, <a class="el" href="nalt_8hpp.html#aa749dc39c69b710b5fcd35616b8267a9">reftype_t</a> type, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> target=<a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f">BADADDR</a>, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> base=0, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> tdelta=0)</td></tr>
<tr class="memdesc:af234e8b816269e8aedda0caeac054574"><td class="mdescLeft">&#160;</td><td class="mdescRight">See <a class="el" href="offset_8hpp.html#a5401e9949fa39da243b0ff771fac6e02" title="Convert operand to a reference. ">op_offset_ex()</a> <br /></td></tr>
<tr class="separator:af234e8b816269e8aedda0caeac054574"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4277352b711db147b321cdb001515cc9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4277352b711db147b321cdb001515cc9"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a4277352b711db147b321cdb001515cc9">op_plain_offset</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> base)</td></tr>
<tr class="memdesc:a4277352b711db147b321cdb001515cc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert operand to a reference with the default reference type. <br /></td></tr>
<tr class="separator:a4277352b711db147b321cdb001515cc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7fe609ff913258096056efcc1ca81b3c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a7fe609ff913258096056efcc1ca81b3c">get_offbase</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n)</td></tr>
<tr class="memdesc:a7fe609ff913258096056efcc1ca81b3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get offset base value.  <a href="#a7fe609ff913258096056efcc1ca81b3c">More...</a><br /></td></tr>
<tr class="separator:a7fe609ff913258096056efcc1ca81b3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8030e204c4f02c6cd69dd62f2f0c65c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#ab8030e204c4f02c6cd69dd62f2f0c65c">get_offset_expression</a> (<a class="el" href="pro_8h.html#a386c10c6aa4340f1d63df85f40454fce">qstring</a> *buf, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> from, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> offset, int getn_flags=0)</td></tr>
<tr class="memdesc:ab8030e204c4f02c6cd69dd62f2f0c65c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get offset expression (in the form "offset name+displ").  <a href="#ab8030e204c4f02c6cd69dd62f2f0c65c">More...</a><br /></td></tr>
<tr class="separator:ab8030e204c4f02c6cd69dd62f2f0c65c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8d0a781c9e180ff36813c479ed93d31"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab8d0a781c9e180ff36813c479ed93d31"></a>
<a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#ab8d0a781c9e180ff36813c479ed93d31">get_offset_expr</a> (<a class="el" href="pro_8h.html#a386c10c6aa4340f1d63df85f40454fce">qstring</a> *buf, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, const <a class="el" href="structrefinfo__t.html">refinfo_t</a> &amp;ri, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> from, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> offset, int getn_flags=0)</td></tr>
<tr class="memdesc:ab8d0a781c9e180ff36813c479ed93d31"><td class="mdescLeft">&#160;</td><td class="mdescRight">See <a class="el" href="offset_8hpp.html#ab8030e204c4f02c6cd69dd62f2f0c65c" title="Get offset expression (in the form &quot;offset name+displ&quot;). ">get_offset_expression()</a> <br /></td></tr>
<tr class="separator:ab8d0a781c9e180ff36813c479ed93d31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a34d1e626f4b77cca25b120ccfa96434a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a34d1e626f4b77cca25b120ccfa96434a">can_be_off32</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea)</td></tr>
<tr class="memdesc:a34d1e626f4b77cca25b120ccfa96434a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Does the specified address contain a valid OFF32 value?.  <a href="#a34d1e626f4b77cca25b120ccfa96434a">More...</a><br /></td></tr>
<tr class="separator:a34d1e626f4b77cca25b120ccfa96434a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a984cc7dbadcde307960d0c8867707935"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a984cc7dbadcde307960d0c8867707935">calc_offset_base</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n)</td></tr>
<tr class="memdesc:a984cc7dbadcde307960d0c8867707935"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try to calculate the offset base This function takes into account the fixup information, current ds and cs values.  <a href="#a984cc7dbadcde307960d0c8867707935">More...</a><br /></td></tr>
<tr class="separator:a984cc7dbadcde307960d0c8867707935"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3035e749c86de45f3a67d025ee536c86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a3035e749c86de45f3a67d025ee536c86">calc_probable_base_by_value</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, <a class="el" href="pro_8h.html#aef265b11f25357d520dcfd40aa8c18f3">uval_t</a> off)</td></tr>
<tr class="memdesc:a3035e749c86de45f3a67d025ee536c86"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try to calculate the offset base.  <a href="#a3035e749c86de45f3a67d025ee536c86">More...</a><br /></td></tr>
<tr class="separator:a3035e749c86de45f3a67d025ee536c86"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a998f1a3dfcf021e4e1d4db53f7916a23"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> bool <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a998f1a3dfcf021e4e1d4db53f7916a23">calc_reference_data</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> *target, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> *base, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> from, const <a class="el" href="structrefinfo__t.html">refinfo_t</a> &amp;ri, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> opval)</td></tr>
<tr class="memdesc:a998f1a3dfcf021e4e1d4db53f7916a23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the target and base addresses of an offset expression.  <a href="#a998f1a3dfcf021e4e1d4db53f7916a23">More...</a><br /></td></tr>
<tr class="separator:a998f1a3dfcf021e4e1d4db53f7916a23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabd4f991193b398eb7ae6485f09d14d3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#aabd4f991193b398eb7ae6485f09d14d3">add_refinfo_dref</a> (const <a class="el" href="classinsn__t.html">insn_t</a> &amp;insn, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> from, const <a class="el" href="structrefinfo__t.html">refinfo_t</a> &amp;ri, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> opval, <a class="el" href="group__xref__type.html#ga78aab6d0d6bd9cb4904bbdbb5ac4fa71">dref_t</a> type, int opoff)</td></tr>
<tr class="memdesc:aabd4f991193b398eb7ae6485f09d14d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add xrefs for a reference from the given instruction ({ea}).  <a href="#aabd4f991193b398eb7ae6485f09d14d3">More...</a><br /></td></tr>
<tr class="separator:aabd4f991193b398eb7ae6485f09d14d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aedb7894e1eb35ef05490e7b50fc0e425"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aedb7894e1eb35ef05490e7b50fc0e425"></a>
<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#aedb7894e1eb35ef05490e7b50fc0e425">calc_target</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> from, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> ea, int n, <a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a> opval)</td></tr>
<tr class="memdesc:aedb7894e1eb35ef05490e7b50fc0e425"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves <a class="el" href="structrefinfo__t.html" title="Information about a reference. ">refinfo_t</a> structure and calculates the target. <br /></td></tr>
<tr class="separator:aedb7894e1eb35ef05490e7b50fc0e425"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4109990af791198ef619cf6ebfba7361"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4109990af791198ef619cf6ebfba7361"></a>
<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="offset_8hpp.html#a4109990af791198ef619cf6ebfba7361">calc_basevalue</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> target, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> base)</td></tr>
<tr class="memdesc:a4109990af791198ef619cf6ebfba7361"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the value of the reference base. <br /></td></tr>
<tr class="separator:a4109990af791198ef619cf6ebfba7361"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="abab62af2f5bde2632931d05e4dea7c68"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="nalt_8hpp.html#aa749dc39c69b710b5fcd35616b8267a9">reftype_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> get_default_reftype </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get default reference type depending on the segment. </p>
<dl class="section return"><dt>Returns</dt><dd>one of <a class="el" href="group__reftype__.html#ga67f77788a531e1c925f610704430744a" title="8bit full offset ">REF_OFF8</a>,<a class="el" href="group__reftype__.html#gaae74e842ed8ee99ddb41f72ecbab35af" title="16bit full offset ">REF_OFF16</a>,<a class="el" href="group__reftype__.html#ga9514307c2327fdf250734a64943e1c67" title="32bit full offset ">REF_OFF32</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a5401e9949fa39da243b0ff771fac6e02"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> op_offset_ex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structrefinfo__t.html">refinfo_t</a> *&#160;</td>
          <td class="paramname"><em>ri</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert operand to a reference. </p>
<p>To delete an offset, use <a class="el" href="group___f_f__op.html#gaa2af9a3b5eaf1be072e8052ac0322b90" title="Remove operand representation information. ">clr_op_type()</a> function. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ea</td><td>linear address. if 'ea' has unexplored bytes, try to convert them to<ul>
<li>no segment: fail</li>
<li>16bit segment: to 16bit word data</li>
<li>32bit segment: to dword </li>
</ul>
</td></tr>
    <tr><td class="paramname">n</td><td>number of operand (may be ORed with <a class="el" href="group___f_f__op.html#gae3ff56ce8ed4030acdca9d9314038dfb" title="outer offset base (combined with operand number). ">OPND_OUTER</a>)<ul>
<li>0: first</li>
<li>1: second</li>
<li>2: third</li>
<li><a class="el" href="group___f_f__op.html#ga3177b4c883cc4b74938f6fb7559587c0" title="mask for operand number ">OPND_MASK</a>: all operands </li>
</ul>
</td></tr>
    <tr><td class="paramname">ri</td><td>reference information </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>success </dd></dl>

</div>
</div>
<a class="anchor" id="a7fe609ff913258096056efcc1ca81b3c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> get_offbase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get offset base value. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ea</td><td>linear address </td></tr>
    <tr><td class="paramname">n</td><td>number of operand </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>offset base or <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ab8030e204c4f02c6cd69dd62f2f0c65c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> get_offset_expression </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a386c10c6aa4340f1d63df85f40454fce">qstring</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a>&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>getn_flags</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get offset expression (in the form "offset name+displ"). </p>
<p>This function uses offset translation function ( processor_t::translate) if your IDP module has such a function. Translation function is used to map linear addresses in the program (only for offsets).</p>
<p>Example: suppose we have instruction at linear address 0x00011000: </p><pre class="fragment">mov     ax, [bx+7422h] </pre><p> and at ds:7422h: </p><pre class="fragment">array   dw      ... </pre><p> We want to represent the second operand with an offset expression, so then we call: </p><pre class="fragment">get_offset_expresion(0x001100, 1, 0x001102, 0x7422, buf);
                     |         |  |         |       |
                     |         |  |         |       +output buffer
                     |         |  |         +value of offset expression
                     |         |  +address offset value in the instruction
                     |         +the second operand
                     +address of instruction</pre><p> and the function will return a colored string: </p><pre class="fragment">offset array </pre> <dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>output buffer to hold offset expression </td></tr>
    <tr><td class="paramname">ea</td><td>start of instruction or data with the offset expression </td></tr>
    <tr><td class="paramname">n</td><td>number of operand (may be ORed with <a class="el" href="group___f_f__op.html#gae3ff56ce8ed4030acdca9d9314038dfb" title="outer offset base (combined with operand number). ">OPND_OUTER</a>)<ul>
<li>0: first operand</li>
<li>1: second operand </li>
</ul>
</td></tr>
    <tr><td class="paramname">from</td><td>linear address of instruction operand or data referring to the name. This address will be used to get fixup information, so it should point to exact position of operand in the instruction. </td></tr>
    <tr><td class="paramname">offset</td><td>value of operand or its part. The function will return text representation of this value as offset expression. </td></tr>
    <tr><td class="paramname">getn_flags</td><td>combination of:<ul>
<li><a class="el" href="group___g_e_t_n__.html#ga1d81af73461e98bd691ef1337d72a018" title="meaningful only if the name refers to a structure. ">GETN_APPZERO</a>: meaningful only if the name refers to a structure. appends the struct field name if the field offset is zero</li>
<li><a class="el" href="group___g_e_t_n__.html#ga087e60e7f734e12197cbd6f3fd0238eb" title="do not create a new dummy name but pretend it exists ">GETN_NODUMMY</a>: do not generate dummy names for the expression but pretend they already exist (useful to verify that the offset expression can be represented) </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>can't convert to offset expression </td></tr>
    <tr><td class="paramname">1</td><td>ok, a simple offset expression </td></tr>
    <tr><td class="paramname">2</td><td>ok, a complex offset expression </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a34d1e626f4b77cca25b120ccfa96434a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> can_be_off32 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Does the specified address contain a valid OFF32 value?. </p>
<p>For symbols in special segments the displacement is not taken into account. If yes, then the target address of OFF32 will be returned. If not, then <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> is returned. </p>

</div>
</div>
<a class="anchor" id="a984cc7dbadcde307960d0c8867707935"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> calc_offset_base </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Try to calculate the offset base This function takes into account the fixup information, current ds and cs values. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ea</td><td>the referencing instruction/data address </td></tr>
    <tr><td class="paramname">n</td><td>operand number<ul>
<li>0: first operand</li>
<li>1: other operand </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>output base address or <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a3035e749c86de45f3a67d025ee536c86"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> calc_probable_base_by_value </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>ea</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#aef265b11f25357d520dcfd40aa8c18f3">uval_t</a>&#160;</td>
          <td class="paramname"><em>off</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Try to calculate the offset base. </p>
<p>2 bases are checked: current ds and cs. If fails, return <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> </p>

</div>
</div>
<a class="anchor" id="a998f1a3dfcf021e4e1d4db53f7916a23"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> bool <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> calc_reference_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> *&#160;</td>
          <td class="paramname"><em>target</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structrefinfo__t.html">refinfo_t</a> &amp;&#160;</td>
          <td class="paramname"><em>ri</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a>&#160;</td>
          <td class="paramname"><em>opval</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculate the target and base addresses of an offset expression. </p>
<p>The calculated target and base addresses are returned in the locations pointed by 'base' and 'target'. In addition, the 'ri' argument may be modified if ri.base is <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a>. In this case the function calculates the offset base address from the referencing instruction/data address and saves it in the 'ri' structure. The target address is copied from ri.target. If ri.target is <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> then the target is calculated using the base address and 'opval'. This function also checks if 'opval' matches the full value of the reference and takes in account the memory-mapping. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">target</td><td>output target address </td></tr>
    <tr><td class="paramname">base</td><td>output base address </td></tr>
    <tr><td class="paramname">from</td><td>the referencing instruction/data address </td></tr>
    <tr><td class="paramname">ri</td><td>reference info block from the database </td></tr>
    <tr><td class="paramname">opval</td><td>operand value (usually <a class="el" href="classop__t.html#a6baa38b521c143a794640d82df109ae2" title="operand value (o_imm) or outer displacement (o_displ+OF_OUTER_DISP). ">op_t::value</a> or <a class="el" href="classop__t.html#acaaeff517df0b7156b4b8521a3900cdc" title="virtual address pointed or used by the operand. ">op_t::addr</a>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>success </dd></dl>

</div>
</div>
<a class="anchor" id="aabd4f991193b398eb7ae6485f09d14d3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> add_refinfo_dref </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classinsn__t.html">insn_t</a> &amp;&#160;</td>
          <td class="paramname"><em>insn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structrefinfo__t.html">refinfo_t</a> &amp;&#160;</td>
          <td class="paramname"><em>ri</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#ac29a387cc69c0d1abb2f2ef05dad1a6f">adiff_t</a>&#160;</td>
          <td class="paramname"><em>opval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__xref__type.html#ga78aab6d0d6bd9cb4904bbdbb5ac4fa71">dref_t</a>&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>opoff</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Add xrefs for a reference from the given instruction ({ea}). </p>
<p>This function creates a cross references to the target and the base. <a class="el" href="group___s_t_k_v_a_r__2.html#ga9adc3c8e4695148f4892253ea1b067ff" title="Add xrefs for an operand of the instruction. ">insn_t::add_off_drefs()</a> calls this function to create xrefs for 'offset' operand. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">insn</td><td>the referencing instruction </td></tr>
    <tr><td class="paramname">from</td><td>the referencing instruction/data address </td></tr>
    <tr><td class="paramname">ri</td><td>reference info block from the database </td></tr>
    <tr><td class="paramname">opval</td><td>operand value (usually <a class="el" href="classop__t.html#a6baa38b521c143a794640d82df109ae2" title="operand value (o_imm) or outer displacement (o_displ+OF_OUTER_DISP). ">op_t::value</a> or <a class="el" href="classop__t.html#acaaeff517df0b7156b4b8521a3900cdc" title="virtual address pointed or used by the operand. ">op_t::addr</a>) </td></tr>
    <tr><td class="paramname">type</td><td>type of xref </td></tr>
    <tr><td class="paramname">opoff</td><td>offset of the operand from the start of instruction </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the target address of the reference </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
